import request from '@/utils/request'
import qs from 'qs'

// 开电源,关电源
export function sourceSetOnOff(data) {
  return request({
    url: '/source/setOnOff',
    method: 'post',
    data:qs.stringify(data, { indices: false }), // {state:0}	开电源1，关电源0
  })
}
//写电流
export function sourceSetIRange(data) {
  return request({
    url: '/source/setIRange',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//写频率
export function sourceSetF(data) {
  return request({
    url: '/source/setF',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//写相位
export function sourceSetP(data) {
  return request({
    url: '/source/setP',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//写所有电流相位
export function sourceSetPAll(data) {
  return request({
    url: '/source/setPAll',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}

// 电源状态，设备报警状态
export function sourceState() {
  return request({
    url: '/source/state',
    method: 'post',
  })
}
// 液晶显示
export function commLcd(data) {
  return request({
    url: '/comm/lcd',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 设置表信息
export function commSendInfo(data) {
  return request({
    url: '/comm/sendInfo',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 表状态是否挂表
export function commSendMeterState(data) {
  return request({
    url: '/comm/sendMeterState',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 设置电压
export function commSendVoltage(data) {
  return request({
    url: '/comm/sendVoltage',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 倒计时-秒
export function commTime(data) {
  return request({
    url: '/comm/time',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 声音
export function commVoice(data) {
  return request({
    url: '/comm/voice',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}

// 应用已读取的表地址开发中
export function meterApplyMeterAddress(data) {
  return request({
    url: '/meter/applyMeterAddress',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//根据终端pos查询终端和所属测量点
export function terminalSelectByPos(data) {
  return request({
    url: '/terminal/selectByPos',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 通讯参数故障
export function meterCommParmFalut(data) {
  return request({
    url: '/meter/commParmFalut',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 仿真表故障-三相故障
export function meterFzbFault(data) {
  return request({
    url: '/meter/fzbFault',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 仿真表故障-单相
export function meterFzbSingleFault(data) {
  return request({
    url: '/meter/fzbSingleFault',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//三相表恢复
export function meterFzbFaultRecoveryAll(data) {
  return request({
    url: '/meter/fzbFaultRecoveryAll',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// /单相表恢复
export function meterFzbSingleFaultRecoveryAll(data) {
  return request({
    url: '/meter/fzbSingleFaultRecoveryAll',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 集中器故障
export function meterJzqFault(data) {
  return request({
    url: '/meter/jzqFault',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 集中器故障恢复所有
export function meterJzqFaultRecoveryAll(data) {
  return request({
    url: '/meter/jzqFaultRecoveryAll',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 读写电能表数据采集
export function meterMeterDataCollection(data) {
  return request({
    url: '/meter/meterDataCollection',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}// 读写电能表数据采集ById
export function meterDataCollectionById(data) {
  return request({
    url: '/meter/meterDataCollectionById',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 电能表读地址
export function meterReadMeterAddr(data) {
  return request({
    url: '/meter/readMeterAddr',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 表位接线故障
export function meterRelayFault(data) {
  return request({
    url: '/meter/relayFault',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 表位接线故障恢复所有
export function meterRelayFaultRecoveryAll(data) {
  return request({
    url: '/meter/relayFaultRecoveryAll',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 电能表写地址
export function meterWriteMeterAddr(data) {
  return request({
    url: '/meter/writeMeterAddr',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 表位方案编辑
export function meterPositionPlanUpdate(data) {
  return request({
    url: '/meterPositionPlan/update',
    method: 'post',
    data,
  })
}
// 测量点新增
export function measuringPointParameterSave(data) {
  return request({
    url: '/MeasuringPointParameter/save',
    method: 'post',
    data,
  })
}
// 测量点编辑
export function measuringPointParameterUpdate(data) {
  return request({
    url: '/MeasuringPointParameter/update',
    method: 'post',
    data,
  })
}
// 测量点删除
export function measuringPointParameterRemove(data) {
  return request({
    url: '/MeasuringPointParameter/remove',
    method: 'post',
    data,
  })
}
// 测量点故障保存
export function measuringPointParameterFaultSave(data) {
  return request({
    url: '/MeasuringPointParameter/faultSave',
    method: 'post',
    data,//:qs.stringify(data, { indices: false }),
  })
}
// 测量点故障保存
export function measuringPointParameterMeterParam(data) {
  return request({
    url: '/MeasuringPointParameter/meterParam',
    method: 'post',
    data,//:qs.stringify(data, { indices: false }),
  })
}
// 测量点参数故障
export function meterCldParmFalut(data) {
  return request({
    url: '/meter/cldParmFalut',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 表位查询-线损设置用
export function meterPositionListLineLoss(data) {
  return request({
    url: '/meterPosition/listLineLoss',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//
// 表位查询-表位故障-表位信息设置用
export function meterPositionListSet(data) {
  return request({
    url: '/meterPosition/listSet',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 终端档案列表查询
export function terminalList(data) {
  return request({
    url: '/terminal/list',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 终端档案新增
export function terminalSave(data) {
  return request({
    url: '/terminal/save',
    method: 'post',
    data//:qs.stringify(data, { indices: false }),
  })
}
// 终端档案编辑
export function terminalUpdate(data) {
  return request({
    url: '/terminal/update',
    method: 'post',
    data//:qs.stringify(data, { indices: false }),
  })
}
// 终端档案删除
export function terminalRemove(data) {
  return request({
    url: '/terminal/remove',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 电价编辑
export function sElectricityPriceUpdate(data) {
  return request({
    url: '/sElectricityPrice/update',
    method: 'post',
    data,//:qs.stringify(data, { indices: false }),
  })
}
// 设备列表
export function devList(data) {
  return request({
    url: '/dev/list',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 编辑设备
export function devUpdate(data) {
  return request({
    url: '/dev/update',
    method: 'post',
    data//:qs.stringify(data, { indices: false }),
  })
}
//系统设置-终端参数/meter/meterParamJzq
export function meterMeterParamJzq(data) {
  return request({
    url: '/meter/meterParamJzq',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
// 题库列表
export function questionBankList() {
  return request({
    url: '/question-bank/list',
    method: 'post',
  })
}
export function miswiringBankList() {
  return request({
    url: '/miswiring-question-bank/list',
    method: 'post',
  })
}
export function miswiringList(data) {
  return request({
    url: '/miswiring-question/list',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}

// 试题列表
export function questionList(data) {
  return request({
    url: '/question/list',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//删除题库
export function questionBankRemove(data) {
  return request({
    url: '/question-bank/remove',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
export function miswiringBankRemove(data) {
  return request({
    url: '/miswiring-question-bank/remove',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//删除试题
export function questionRemove(data) {
  return request({
    url: '/question/remove',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//新增题库
export function questionBankSave(data) {
  return request({
    url: '/question-bank/save',
    method: 'post',
    data,
  })
}
//新增题库
export function miswiringBankSave(data) {
  return request({
    url: '/miswiring-question-bank/save',
    method: 'post',
    data,
  })
}
export function miswiringSave(data) {
  return request({
    url: '/miswiring-question/save',
    method: 'post',
    data,
  })
}

//新增试题
export function questionSave(data) {
  return request({
    url: '/question/save',
    method: 'post',
    data,
  })
}
//编辑题库
export function questionBankUpdate(data) {
  return request({
    url: '/question-bank/update',
    method: 'post',
    data,
  })
}
export function miswiringBankUpdate(data) {
  return request({
    url: '/miswiring-question-bank/update',
    method: 'post',
    data,
  })
}
//编辑试题
export function questionUpdate(data) {
  return request({
    url: '/question/update',
    method: 'post',
    data,
  })
}
///密码验证
export function userCheckPassword(data) {
  return request({
    url: '/user/checkPassword',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
///密码修改
export function userUpdatePassword(data) {
  return request({
    url: '/user/updatePassword',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//更新状态 /user/updateState
export function userUpdateState(data) {
  return request({
    url: '/user/updateState',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//更新列表 /user/updateState
export function userSelectState() {
  return request({
    url: '/user/selectState',
    method: 'post',
  })
}
//轮显列表
export function meterShowList(data) {
  return request({
    url: '/meterShow/list',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//设置轮显
export function meterMeterShow(data) {
  return request({
    url: '/meter/meterShow',
    method: 'post',
    data:qs.stringify(data, { indices: false }),
  })
}
//保存错接线题库
// export function meterDataCollectionById(data) {
//   return request({
//     url: '/meter/meterDataCollectionById',
//     method: 'post',
//     data:qs.stringify(data, { indices: false }),
//   })
// }
// //发送错接线题库
// export function meterDataCollectionById(data) {
//   return request({
//     url: '/meter/meterDataCollectionById',
//     method: 'post',
//     data:qs.stringify(data, { indices: false }),
//   })
// }